package com.blb.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.blb.entity.ResponseHelp;
import com.blb.entity.Share;
import com.blb.service.IShareService;
import com.blb.utils.UUIDUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xuyuanxin
 * @since 2019-12-23
 */
@RestController
@RequestMapping("/share")
public class ShareController {
    @Autowired
    private IShareService shareService;

    /**
     * 点击分享弹框保存数据到分享表里
     * @param nodeId
     * @param userId
     * @param shareLink
     * @return
             */
    @GetMapping("createLink")
    public ResponseHelp shareLink(String nodeId, String userId,String shareLink){

        Share share = new Share();
        share.setId(UUIDUtils.getId());
        share.setNotesId(nodeId);
        share.setUserId(userId);
        share.setShareLink(shareLink);
        share.setType("note");
        shareService.save(share);

        return new ResponseHelp();
    }

}

